<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <h1>navigator对象-浏览相关信息</h1>
    <script>
        // 可以判断用户使用的终端类型(移动端还是pc端设备)
        console.log(navigator.userAgent);
        if(navigator.userAgent.toLowerCase().includes('win')){
            alert('pc端设备')
        }else if(navigator.userAgent.toLowerCase().includes('iphone') || navigator.userAgent.includes('android')){
            alert('移动端设备')
        }
    </script>
</body>

</html>